
package com.yx1996.web.servlet;


import com.yx1996.domain.Customer;
import com.yx1996.service.CustomerService;
import com.yx1996.serviceimpl.CustomerServiceImpl;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class ListCustomerServlet extends HttpServlet {

    private CustomerService customerService = new CustomerServiceImpl();
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        List<Customer> list = customerService.getAll();
        request.setAttribute("list",list);
        request.getRequestDispatcher(request.getContextPath()+"/jsp/customer/list.jsp").forward(request,response);
    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }

}
